This invention relates to control of storage devices in general, and more specifically to a device driver for a storage device employing an adaptive throttling technique that dynamically reduces/increases the number of commands that can be issued to a storage device, such as a Fiber Channel disk, to avoid overloading the storage device.
Increasing demand on computer network systems has created a need for high-performance communications between servers and storage devices and servers and other devices. Fiber Channel is a high-speed, full-duplex, serial data transfer architecture that uses optical fiber to connect various devices such as servers and storage devices. Fiber Channel supports multiple protocols including Small Computer System Interface (SCSI) and Internet Protocol (IP). Storage devices connected to a Fiber Channel network operate with both SCSI and networking (IP) protocols. Servers and workstations can use the Fiber Channel network for high-speed, shared access to the same storage device or system such as a Redundant Array of Independent Disks (RAID). Fiber Channel has supported both peer-to-peer and arbitrated loop topologies and will support a fabric topology.
FIG. 1 is a block diagram illustrating a Fiber Channel peer-to-peer network. This topology consists of a single computer 100 and a single storage device 110 such as an individual disk or a disk array. The computer 100 and the storage device 110 are interconnected using a Fiber Channel cable 105. The computer 100 can communicate with the storage device 110 using Fiber Channel protocol transmitted over the Fiber Channel cable 105. The Fiber Channel protocol can contain SCSI commands issued by the computer 100 to the storage device 110.
FIG. 2 is a block diagram illustrating a Fiber Channel arbitrated loop network. This topology consists of at least one computer 200 and several other devices 210, 215, and 220. These devices can be storage devices such as a disks or arrays of disks, printers, or other peripheral devices. These devices are interconnected using a Fiber Channel cable 205. The computer 200 can communicate with the other devices 210-220 using Fiber Channel protocol transmitted over the Fiber Channel cable 205. Control of the loop can be based on token passing or another arbitration scheme. When the computer 200 communicates with storage devices in the network, the Fiber Channel protocol can contain SCSI commands issued by the computer 200 to the storage device.
FIG. 3 is a block diagram illustrating a Fiber Channel fabric based network. This topology consists of at least one computer 300, at least one switch 310, and a number of other devices 315-325. These devices can consist of other computers, other switches, disks, printers or other peripheral devices. These devices are interconnected using a Fiber Channel cable 305. The nature of such a fabric allows the network to be easily expanded and creates great flexibility. Therefore, many layouts different from that illustrated in FIG. 3 can be imagined. The computer 300 can communicate with other devices 315-325 on the fabric through the switch 310. To communicate with a storage device the computer 300 transmits a frame containing Fiber Channel protocol and SCSI commands through the switch 310 to the storage device.
In each topology a problem can arise when Fiber Channel is used to connect a Fiber Channel SCSI disk drive. For these drive types, the Fiber Channel commands along with the SCSI commands require more memory, firmware code, and time for the processors in the storage devices to handle than SCSI commands alone. This increased processing time combined with the increased speed of the Fiber Channel network means that the storage device""s processor may not be able to respond before the arrival of the next frame. Since the storage device has an internal queue, this is normally not a problem. However, if the queue becomes full, the computer may send additional frames before the storage device can signal the full condition to the computer.
FIG. 4 is a block diagram illustrating exemplary handshaking between an initiator and a storage device. In this example a computer 400 issues a write command 405 to a disk drive. Normally, a write command 405 generated at the computer 400 is submitted to the file system 410. The file system 410 then passes the write command 405 to the software disk driver 415 that issues the command to a bus interface 420, such as a host bus adapter. The bus interface 420 is connected to a disk 435. The bus interface issues the write command to the disk 435 that then processes the command and responds back 425 to the bus interface 420. The bus interface 420 then passes the response back to the software disk driver 415. Finally, completion information associated with the response may be provided by the software disk driver 415 to the file system 410.
FIG. 5 is a block diagram illustrating a computer 500 issuing a write command 505 to a disk drive 535 when the disk""s queue is full. Normally, the write command 505 generated at the computer 500 is submitted to the file system 510. The file system 510 then passes the write command to the software disk driver 515 which issues the command to a bus interface 520 such as a host bus adapter. The bus interface 520 issues the write command 530 to the disk 535 which then processes the command and responds back 525 to the bus interface 520. The bus interface 520 then passes the response back to the software disk driver 515. Finally, completion information associated with the response may be provided by the software disk driver 515 to the file system 510.
When the disk 535 receives the command, the disk temporarily stores the command in a queue (not shown) until it can be processed. If the queue becomes full, the disk 535 returns a queue full signal 525 to the bus interface 520. Additionally, if the host bus adapter is busy, it may return a busy signal to the software disk driver 515. In either case the command has returned to the software disk driver 515 without being processed by the disk 535.
Since the Fiber Channel protocol may include SCSI commands as well as other commands, the Fiber Channel protocol is more processor intensive than SCSI alone. Consequently, the processing of Fiber Channel protocol takes considerably longer. Typically, SCSI disks can respond to a write request with a queue full signal quickly. However, because of the increased load on the disk""s processing resources due to the Fiber Channel protocol, a disk connected to a Fiber Channel network may take longer than normal to respond to a write request.
Normally, a disk responds to a write command with a queue full signal before the queue is completely full. Therefore, a disk can still receive some commands even after a queue full signal has been sent. However, problems occur when a disk is receiving commands faster than it can clear the queue. If the disk continues to receive commands after the occurrence of a queue full condition the queue can be exceeded and several commands can be sent and missed (e.g., silently dropped by the disk). In this event, the missed commands result in a timeout error being sent from the host bus adapter to the software disk driver.
In the peer-to-peer topology this problem has been easy to address. The simple solution for this situation is to limit the number of commands a device may send to the storage device to the maximum number of commands that the storage device can handle. For example, if the storage device has a queue depth of 64 commands, the computer may be limited to issuing no more than 64 commands at one time (e.g., no more than 64 commands may be pending). In this way the storage device""s queue will never be exceeded.
In the arbitrated loop topology the problem is still relatively easy to solve by limiting the number of devices that may be on the loop and hardcoding the maximum number of commands that may be issued. Assuming the loop is limited to having four initiators, the maximum number of commands that any one device may issue at one time may be limited to the maximum number of commands a disk can handle divided by four. For example, if the storage device has a queue depth of 64 commands, the computers in the network may be limited to having no more than 16 (64 divided by 4) commands pending. In this way the storage device""s queue will never be exceeded. In other instances there may be more than four initiators on the loop. In such a cause the limit should be the queue depth divided by the number of initiators.
In a fabric topology, this problem becomes much more difficult to solve. Because of the nature of the fabric topology an indeterminant number of devices may be connected to the network at one time. Therefore, limiting or throttling the number of commands a device can issue at one time based on the number of devices connected to the network becomes impractical.
According to one aspect of the invention, a method and apparatus for throttling commands to a storage device is disclosed. This method comprises sending a write request to a disk, receiving a queue full signal from the disk if the disk queue is full, and responsive to receiving the queue full signal setting a throttle value.